﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using HAUtil;

using System.IO;

namespace HAGISV2
{

    /// <summary>
    /// 用于存储辅助行功能数据，提供辅助功能
    /// </summary>
    public class AssistSystem : SubSystem
    {


        public AssistSystem(GisManager gis):base(gis)
        {
 
        }


        AssistData _assistData;

        public AssistData AssistData
        {
            get { return _assistData; }

        }


        //#region 功能函数

        //public string GetNextPointId()
        //{
        //    int index = this._assistData.PtIndex;

        //    this._assistData.PtIndex += 1;

        //    return "point" + index.ToString();

        //}

        //public string GetNextLineId()
        //{
        //    int index = this._assistData.LnIndex;

        //    this._assistData.LnIndex += 1;

        //    return "line" + index.ToString();

        //}

        //public string GetNextPolyLineId()
        //{
        //    int index = this._assistData.PolylineIndex;

        //    this._assistData.PolylineIndex += 1;

        //    return "polyline" + index.ToString();

        //}

        //public string GetNextPolygonId()
        //{
        //    int index = this._assistData.PolygonIndex;

        //    this._assistData.PolygonIndex += 1;

        //    return "polygon" + index.ToString();

        //}



        //#endregion


        #region 项目相关

        public bool SaveProj()
        {

            bool b = false;




            b = FileOperations.SaveToBinary(this.GisManager.AbsProjAssistName, this._assistData);




            return b;


        }


        public bool OpenProj()
        {
            if (!File.Exists(this.GisManager.AbsProjPathName))
            {
                return false;
            }

            bool b = false;


            this._assistData = (AssistData)FileOperations.OpenFromBinary(this.GisManager.AbsProjAssistName, ref b);

          






            return b;




        }

        public bool NewProj()
        {

            this._assistData = new AssistData();
        

            return true;

        }

     

        public bool CloseProj()
        {

            this._assistData = null;
          




        

            return true;
        }


        #endregion

    }
}
